#include "comm.hpp"

int main(){
    key_t k = getKey();
    // cout<<"server:k="<<k<<endl;
    printf("0x%x\n",k);
    int shmid = createShm(k,gsize);
    cout<<"server:id"<<shmid<<endl;

    char* addr  = (char*)shmat(shmid,nullptr,0);


    sleep(15);
    // int n = 0;
    // while(n <= 30)
    // {
    //     cout <<"client -> server# "<< addr << endl;
    //     sleep(1);
    //     n++;
    // }

    cout<<addr<<endl;

    shmdt(addr);
    shmctl(shmid,IPC_RMID,nullptr);
    return 0;
}